<?php

include 'widgets/AbeeCart.php';
include 'woocommerceHooks.php';
/*
 * Functions for the abee shop template - child of abee lajt template.
 */

register_sidebar(array(
    'name' => __('Head Sidebar'),
    'id' => 'abee-head-sidebar',
    'description' => __('Widgets in this area will be shown on the same height as logo in header.'),
    'before_widget' => '<div id="%1$s" class="abee-header-widget %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>'
));
register_sidebar(array(
    'name' => __('Kolumna Sklepu'),
    'before_widget' => '<div class="divwidget bgpng">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>'
));
register_sidebar(array(
    'name' => __('Głowna Kolumna Sklepu'),
    'description' => __('Główna, prawa, szeroka kolumna sklepu. Standardowo w pierwszej kolejności wyświetlany jest slider. Niżej elementy umieszczone poniżej:'),
    'before_widget' => '<div class="divwidget bgpng abee_right_column">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>'
));

// Add currency / symbol
//add_filter( 'woocommerce_currencies', 'add_rand_currency' );
add_filter('woocommerce_currency_symbol', 'add_rand_currency_symbol');

//Modify Polish currency, buf from woocommerce
function add_rand_currency_symbol($symbol) {
    $currency = get_option('woocommerce_currency');
    switch ($currency) {
        case 'PLN': $symbol = 'zł';
            break;
    }
    return $symbol;
}

//Modification for thmubanils, abeeTheme have bigger ones.
global $pagenow;
if (is_admin() && isset($_GET['activated']) && $pagenow == 'themes.php')
    add_action('init', 'yourtheme_woocommerce_image_dimensions', 1);

function yourtheme_woocommerce_image_dimensions() {
    update_option('woocommerce_thumbnail_image_width', '200'); // Image gallery thumbs
    update_option('woocommerce_thumbnail_image_height', '200');
//// Hard Crop [0 = false, 1 = true]
    update_option('woocommerce_thumbnail_image_crop', 1);
}

/*
 * Adding shop javascript
 */
add_action('wp_enqueue_scripts', 'abeeShopScript');

function abeeShopScript() {
    wp_enqueue_script('abeeShop', get_stylesheet_directory_uri() . '/js/script.js', array('jquery'));
}

/*
 * Progress bar
 */
add_action('loop_start', 'abeeShop_progressbar');

function abeeShop_progressbar() {
    if (is_cart() || is_checkout())
        include 'parts/progressbar.php';
    
    global $pagename;
    if ( $pagename == 'zamowienie-otrzymane' )
        include 'parts/progressbar.php';
}

/*
 * Modifications for admin panel:
 */
?>
